﻿
using System;

using OpenCvSharp;

using Xc.DataAccess.CodeReader.Properties;
using Xc.DataAccess.Core;

namespace Xc.DataAccess.CodeReader.Models.Filters
{
    [Filter("Sobel", FilterType.Algorithm)]
    public class AlgorithmSobel:FilterBase
    {
        [InputParameter("类型")]
        public MatType MatType { get; set; } = MatType.CV_16SC1;
        [InputParameter("XOrder")]
        public int XOrder { get; set; }
        [InputParameter("YOrder")] 
        public int YOrder { get; set; }
        [InputParameter("大小")]
        public ApertureSize Size { get; set; } = ApertureSize.Size3;
        [InputParameter("Scale")]
        public int Scale { get; set; } = 1;
        [InputParameter("Delta")]
        public double Delta { get; set; }
        [InputParameter("边框类型")] 
        public BorderTypes BorderType { get; set; }
        internal override ResultData<Mat> UseChannel(Mat mat, FilterBase[] filterInfos, FilterBase preFilterBase)
        {
            Mat mat1 = new Mat();
            Cv2.Sobel(mat,mat1, MatType,XOrder,YOrder,(int)(Size), Scale, Delta, BorderType);
            return ResultData<Mat>.Accept(TextResource.filter_action_complete, mat1);
        }
    }
}
